from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from config import DevConfig


db = SQLAlchemy()

def create_app():
    app = Flask(__name__)
    app.secret_key = 'US@AKCqvSPePd&Kv!P*a6'
    app.config.from_object(DevConfig)
    #确保http请求返回的json数据中正常显示中文
    app.config['JSON_AS_ASCII'] = False
    db.init_app(app)
    from .main import main
    app.register_blueprint(main, url_prefix='/api/index')

    return app

